package com.second.hand.trading.server.service.impl;

import javax.annotation.Resource;

import com.second.hand.trading.server.dao.OperDao;
import com.second.hand.trading.server.model.LogModel;
import com.second.hand.trading.server.service.OperlogService;
import com.second.hand.trading.server.vo.PageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperlogServiceImpl implements OperlogService {

    @Autowired(required = false)
    public OperDao operDao;

    @Override
    public boolean addlog(LogModel log) {
        return operDao.insert(log) == 1;
    }

    @Override
    public PageVo<LogModel> getlog(int page, int num) {
        List<LogModel> list;
        int count=0;
        count=operDao.countLog();
        list=operDao.getalllog((page-1)*num, num);
        return new PageVo<>(list,count);
    }
}
